package com.scyshkj.university.wechat.wanxiao;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.scyshkj.university.wechat.utils.UuidGenerator;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * Created by 唐旭 on 2016/11/22.
 */
@Data
@Entity
@Table
public class PayApplyResult {
    @Id
    private String uuid = UuidGenerator.generate();

    @JsonProperty("return_code")
    @Column
    private String returnCode;

    @JsonProperty("return_message")
    @Column
    private String returnMessage;

    @JsonProperty("out_id")
    @Column
    private String outId;

    @JsonProperty("apply_id")
    @Column
    private String applyId;

    @JsonProperty("card_balance")
    @Column
    private BigDecimal cardBalance;

    @JsonProperty("unsettle_amount")
    @Column
    private BigDecimal unsettleAmount;

    @JsonProperty("db_balance")
    @Column
    private BigDecimal dbBalance;

    @JsonProperty("norce_str")
    @Column
    private String norceStr;

    public boolean isError() {
        return !returnCode.equalsIgnoreCase("SUCCESS");
    }
}
